package org.xteam.sled.semantic.exp;

public class ExpWiden extends Exp {

	private Exp expr;
	private int width;

	public ExpWiden(Exp expr, int width) {
		this.expr = expr;
		this.width = width;
	}
	
	public Exp getExpr() {
		return expr;
	}
	
	public int width() {
		return width;
	}
	
	public int hashCode() {
		return expr.hashCode() + width;
	}
	
	public boolean equals(Object o) {
		return (o instanceof ExpWiden)
			&& ((ExpWiden)o).width == width
			&& ((ExpWiden)o).expr.equals(expr);
	}
	
	@Override
	public void visit(IExpVisitor visitor) {
		visitor.visitWiden(this);
	}
	
	public String toString() {
		return "widen(" + expr + "," + width +")";
	}

}
